<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY nbsp "&#x00A0;">
]>
<xsl:stylesheet
	version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:msxml="urn:schemas-microsoft-com:xslt"
	xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:Utils="urn:Utils"
	exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets Utils ">


  <xsl:output method="html" omit-xml-declaration="yes"/>

  <xsl:param name="currentPage"/>
  <xsl:param name="rootNode" select="$currentPage/ancestor-or-self::Intro"/>
  <xsl:template match="/">
    <article class="grid_4">
      <h5>Pesquisa</h5>
      <div class="buttons">
          <input id="searchText" onkeypress="returnEnterPress(event);" class="pesquisa" type="text" value="" name="searchText" />
          <a id="searchLink" onclick="copyText()" class="button1">Pesquisar</a>
          <script type="text/javascript">
           <![CDATA[
                        $('#searchText').keypress(function (e) {                            
                            if (e.keyCode == 13) {
                              var path = "]]><xsl:value-of select="umbraco.library:NiceUrl($rootNode/child::SearchPage/@id)" /><![CDATA[";
                              var myTextField = document.getElementsByName('searchText')[0].value;
                              var url = path+"?s="+myTextField;
                              window.location = url;
                              return false;
                            }
                        });
                        
                        function copyText(){
                          var path = "]]><xsl:value-of select="umbraco.library:NiceUrl($rootNode/child::SearchPage/@id)" /><![CDATA[";
                          var myTextField = document.getElementById('searchText').value;
                          window.location = path+"?s="+myTextField;
                        }
                        ]]> 
          </script>

      </div>
      <div class="clear"></div>
    </article>
    <!-- start writing XSLT -->

  </xsl:template>

</xsl:stylesheet>